s = input("Введите скобочную последовательность:")
st = []
g = True
for i in s:
    if i in '({[<':
        st.append(i)
    elif i in ')]}>':
        if not st:
            g = False
            break
        ob = st.pop()
        if ob == '(' and i == ')':
            continue
        if ob == '{' and i == '}':
            continue
        if ob == '[' and i == ']':
            continue
        if ob == '<' and i == '>':
            continue
        g = False
        break
if g and len(st) == 0:
    print("True")
else:
    print("False")







